package com.study.csc.a14waitandnotify;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author csc
 * @Date 2023/10/23 9:38
 * @PackageName:com.study.csc.a14waitandnotify
 * @ClassName: Foodie
 * @Description: 吃货
 * @Version 1.0
 */
public class Foodie extends Thread{


    ArrayBlockingQueue<String> queue;


    public Foodie(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true){
            //不断的把面条放到阻塞队列当中
            try {
                String food = queue.take();
                System.out.println(food);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }


}
